import React,{Component,PropTypes} from 'react'
import styles from './loading.scss'

class Loading extends Component{
    render(){
        let {loading} = this.props;
        if(loading){
            return(
                <div className="loading-center">
                    <div className="loading-box">
                        <div className="circular circular-1"></div>
                        <div className="circular circular-2"></div>
                        <div className="circular circular-3"></div>
                        <div className="circular circular-4"></div>
                        <div className="circular circular-5"></div>
                        <div className="circular circular-6"></div>
                        <div className="circular circular-7"></div>
                        <div className="circular circular-8"></div>
                    </div>
                </div>
            )
        }

        if(this.props.dataLength && this.props.dataLength == 0){
            return (
                <div className="loading-center">
                    <span>暂无数据</span>
                </div>
            )
        }

        return this.props.children;
    }
}
Loading.propTypes = {
    dataLength:PropTypes.number,
    loading:PropTypes.bool,
    children:PropTypes.element
}

export default Loading
